Sunan at-Tirmithiy كتاب الصوم باب ما جاء فى إفطار الصائم المتطوع
Umm-Hāni' said, "I was sitting with the Prophet, peace and blessings of God be upon him, when a drink was brought to him. He drank from it then passed it to me and I drank. I then said, 'I have committed a sin, would you seek [God’s] forgiveness for me?'" "What have you done?" asked the Prophet. I replied, "I was fasting then ended my fast (i.e. before sunset)." He asked, "Were you fulfilling a compensatory fast? (1)" "No." I said. "Then, there is no harm done." said the Prophet. (2) Footnotes (1) When days during the obligatory Ramadān fast are missed with a legitimate excuse, they must be made up during the rest of the year as compensation. (2) i.e. You have not committed a sin, since it was a voluntary fast. Click on ḥadīth to read more